package com.vainycos.lotterysearch.model;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.util.List;

/**
 * @author: Vainycos
 * @description 大乐透开奖信息表的实体类
 * @date: 2022/11/3 11:12
 */
@Data
@TableName("big_lottery_ball")
public class BigLotteryBall {

    /**
     * 主键id
     */
    @TableId(type = IdType.AUTO)
    private Long id;

    /**
     * 期号
     */
    private int periodId;

    /**
     * 红球1
     */
    private int redBallOne;

    /**
     * 红球2
     */
    private int redBallTwo;

    /**
     * 红球3
     */
    private int redBallThree;

    /**
     * 红球4
     */
    private int redBallFour;

    /**
     * 红球5
     */
    private int redBallFive;

    /**
     * 蓝球1
     */
    private int blueBallOne;

    /**
     * 蓝球2
     */
    private int blueBallTwo;

    /**
     * 奖池奖金
     */
    private long prizePoolBonus;

    /**
     * 一等奖注数
     */
    private int firstPrizeNumber;

    /**
     * 一等奖奖金
     */
    private int firstPrizeBonus;

    /**
     * 二等奖注数
     */
    private int secondPrizeNumber;

    /**
     * 二等奖奖金
     */
    private int secondPrizeBonus;

    /**
     * 总投注额
     */
    private int totalBetAmount;

    /**
     * 开奖日期
     */
    private String lotteryDate;

    public BigLotteryBall() {}

    public BigLotteryBall(List<String> infoData) {
        if (infoData.size()==15){
            this.periodId=Integer.parseInt(infoData.get(0));
            this.redBallOne=Integer.parseInt(infoData.get(1));
            this.redBallTwo=Integer.parseInt(infoData.get(2));
            this.redBallThree=Integer.parseInt(infoData.get(3));
            this.redBallFour=Integer.parseInt(infoData.get(4));
            this.redBallFive=Integer.parseInt(infoData.get(5));
            this.blueBallOne=Integer.parseInt(infoData.get(6));
            this.blueBallTwo=Integer.parseInt(infoData.get(7));
            this.prizePoolBonus=Long.parseLong(infoData.get(8));
            this.firstPrizeNumber=Integer.parseInt(infoData.get(9));
            this.firstPrizeBonus=Integer.parseInt(infoData.get(10));
            this.secondPrizeNumber=Integer.parseInt(infoData.get(11));
            this.secondPrizeBonus=Integer.parseInt(infoData.get(12));
            this.totalBetAmount=Integer.parseInt(infoData.get(13));
            this.lotteryDate=infoData.get(14);
        }
    }

    /**
     * 中奖结果通知
     * @return
     */
    public String winnerResult(){
        return this.redBallOne + " "
                + this.redBallTwo + " "
                + this.redBallThree + " "
                + this.redBallFour + " "
                + this.redBallFive + " "
                + this.blueBallOne + " "
                + this.blueBallTwo;
    }
}
